//
//  YTPagingObj.swift
//  YTImgeViewer
//
//  Created by aron on 2018/5/25.
//

import UIKit

class YTPagingObj: NSObject, YTPagingProtocol {
    
    private lazy var pageControlView: YTDefaultPageControlView = {
        let pageControlView = YTDefaultPageControlView()
        return pageControlView
    }()
    
    func imageViewer(_ imageViewer: YTImageViewerController, viewDidLoad: Bool) {
        imageViewer.view.addSubview(self.pageControlView)
    }
    
    func imageViewer(_ imageViewer: YTImageViewerController, viewDidLayoutSubView: Bool) {
        self.pageControlView.frame = CGRect(x: 0, y: imageViewer.view.frame.height - 40, width: imageViewer.view.frame.width, height: 40)
    }
    
    func imageViewer(_ imageViewer: YTImageViewerController, setCurrentPage currentPage: Int, numberOfPages: Int) {
        imageViewer.view.bringSubview(toFront: self.pageControlView)
        self.pageControlView.setPage(currentPage: currentPage, numberOfPages: numberOfPages)
    }
}
